package com.spring.shops.dao;

import com.spring.shops.model.entity.TzProdTagReference;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TzProdTagReferenceMapper {
    int deleteByPrimaryKey(Long referenceId);

    int insert(TzProdTagReference record);

    int insertSelective(TzProdTagReference record);

    TzProdTagReference selectByPrimaryKey(Long referenceId);

    int updateByPrimaryKeySelective(TzProdTagReference record);

    int updateByPrimaryKey(TzProdTagReference record);
     @Insert("insert into yami_shops.tz_prod_tag_reference (shop_id, tag_id, prod_id, status,create_time) VALUES " +
             "(#{shopId},#{tagId},#{prodId},#{status},#{createTime})")
    void save(TzProdTagReference reference);

    /**
     * 根据prodId删除所有数据
     * @param prodId
     */
    @Delete("delete from yami_shops.tz_prod_tag_reference where prod_id=#{prodId}")
    int deleleByProdId(Long prodId);

    /**
     * 根据产品id获取所有的tag id 标签
     * @param prodId
     * @return
     */
    @Select("select * from yami_shops.tz_prod_tag_reference where prod_id=#{prodId}")
    List<Integer> selectByProdId(Integer prodId);
}